package com.kevin.spider.kafka.service;

import jakarta.annotation.Resource;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

/**
 * @author 张帆
 * @date: 2025/4/18 10:22
 */
@Service
public class KafkaProduceService {
    @Resource
    private KafkaTemplate<String, String> kafkaTemplate;

    /**
     * 发送消息
     *
     * @param topic
     * @param key
     * @param message
     */
    public <T> void sendMessage(String topic, String key, String message) {
        kafkaTemplate.send(topic, key, message);
    }
}
